package Project.SendRedMoney.Up_SendRedPacket;

import Project.SendRedMoney.red.OpenMode;

import java.util.ArrayList;

public class NormalMode implements OpenMode {
    @Override
    public ArrayList<Integer> divide(int totalMoney, int count) {
        //创建一个数组
        ArrayList<Integer> list = new ArrayList<>();

        int avg = totalMoney / count; //平均值
        int mod = totalMoney % count; //余数
        for (int i = 0; i < count - 1; i++) {
            list.add(avg);
        }
        //有零头，放在最后一个红包当中
        list.add(avg + mod);
        return list;
    }
}
